import React, { FC, useMemo } from 'react';
import { Table, DataSet } from 'choerodon-ui/pro';

import { TableEditMode } from 'choerodon-ui/pro/lib/table/enum';
import getTableProps from './tableDataSet';

interface TableCellEditProps {}

const TableCellEdit: FC<TableCellEditProps> = () => {
  const tableDs = useMemo(() => new DataSet(getTableProps()), []);
  const columns = useMemo<any>(() => [
    { name: 'name' },
    { name: 'age' },
    { name: 'address', editor: true },
    {
      header: '操作',
      command: () => ['edit'],
    },
  ], []);
  return (
    <Table
      dataSet={tableDs}
      columns={columns}
      editMode={TableEditMode.inline}
    />
  );
};

export default TableCellEdit;
